Select for DeviceStateNotify
authorThomas Jaeger <ThJaeger@gmail.com>
Tue, 29 Sep 2009 06:20:40 +0000 (02:20 -0400)
committerAlexander Larsson <alexl@redhat.com>
Wed, 30 Sep 2009 07:21:11 +0000 (09:21 +0200)
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
https://bugzilla.gnome.org/show_bug.cgi?id=588649

gdk/x11/gdkinput-x11.c
gdk/x11/gdkinputprivate.h

index d580fdb38ddd2036a2d558cabe5fdcd2e14e8c8b..93ff40aaa29bc6f9d062611933e6f0200c0bd2e6 100644 (file)
@@ -278,6 +278,7 @@ _gdk_input_common_find_events (GdkDevicePrivate *gdkdev,
       DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
       if (class != 0)
          classes[i++] = class;
+      DeviceStateNotify (gdkdev->xdevice, gdkdev->devicestatenotify_type, class);
       if (class != 0)
          classes[i++] = class;
     }
@@ -699,6 +700,26 @@ _gdk_input_common_other_event (GdkEvent         *event,
       return TRUE;
     }
 
+  if (xevent->type == gdkdev->devicestatenotify_type)
+    {
+      int i;
+      XDeviceStateNotifyEvent *xdse = (XDeviceStateNotifyEvent *)(xevent);
+      XInputClass *input_class = (XInputClass *)xdse->data;
+      for (i=0; i<xdse->num_classes; i++)
+       {
+         if (input_class->class == ValuatorClass)
+           gdk_input_update_axes (gdkdev, gdkdev->info.num_axes, 0,
+                                  ((XValuatorState *)input_class)->valuators);
+         input_class = (XInputClass *)(((char *)input_class)+input_class->length);
+       }
+
+      GDK_NOTE (EVENTS,
+       g_print ("device state notify:\t\twindow: %ld  device: %ld\n",
+                xdse->window,
+                xdse->deviceid));
+
+      return FALSE;
+    }
   if (xevent->type == gdkdev->proximityin_type ||
       xevent->type == gdkdev->proximityout_type)
     {
index f67c8a78e0f3ee6426041e481bcd9d76997f3dfa..1b89230fcfe7a2b4562df205e80547d12317c8fe 100644 (file)
@@ -83,7 +83,7 @@ struct _GdkDevicePrivate
 
   int buttonpress_type, buttonrelease_type, keypress_type,
       keyrelease_type, motionnotify_type, proximityin_type, 
-      proximityout_type, changenotify_type;
+      proximityout_type, changenotify_type, devicestatenotify_type;
 
   /* true if we need to select a different set of events, but
      can't because this is the core pointer */